package com.oocl.jpa.factory;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 * @description: 
 * @author  XIEMI2
 * @date Aug 9, 2017 7:45:02 PM
 * @version 1.0
 */
public class EntityMngFactory {
	
	private static EntityManager entityManager = null;
	

	public static EntityManager getEntityManager(String name) {
		if(entityManager == null){
			EntityManagerFactory factory = Persistence.createEntityManagerFactory(name);
			entityManager = (EntityManager) factory.createEntityManager();
		}
		return entityManager;
	}


	
}


